﻿package morn.core.components
{
    import flash.display.*;
    import flash.events.*;

    public class LayoutBox extends Box
    {
        protected var _space:int = 0;
        protected var _align:String = "none";

        public function LayoutBox()
        {
            return;
        }// end function

        override public function addChild(param1:DisplayObject) : DisplayObject
        {
            param1.addEventListener(Event.RESIZE, this.onResize);
            callLater(this.changeItems);
            return super.addChild(param1);
        }// end function

        private function onResize(event:Event) : void
        {
            callLater(this.changeItems);
            return;
        }// end function

        override public function addChildAt(param1:DisplayObject, param2:int) : DisplayObject
        {
            param1.addEventListener(Event.RESIZE, this.onResize);
            callLater(this.changeItems);
            return super.addChildAt(param1, param2);
        }// end function

        override public function removeChild(param1:DisplayObject) : DisplayObject
        {
            param1.removeEventListener(Event.RESIZE, this.onResize);
            callLater(this.changeItems);
            return super.removeChild(param1);
        }// end function

        override public function removeChildAt(param1:int) : DisplayObject
        {
            getChildAt(param1).removeEventListener(Event.RESIZE, this.onResize);
            callLater(this.changeItems);
            return super.removeChildAt(param1);
        }// end function

        override public function commitMeasure() : void
        {
            exeCallLater(this.changeItems);
            return;
        }// end function

        public function refresh() : void
        {
            callLater(this.changeItems);
            return;
        }// end function

        protected function changeItems() : void
        {
            return;
        }// end function

        public function get space() : int
        {
            return this._space;
        }// end function

        public function set space(param1:int) : void
        {
            this._space = param1;
            callLater(this.changeItems);
            return;
        }// end function

        public function get align() : String
        {
            return this._align;
        }// end function

        public function set align(param1:String) : void
        {
            this._align = param1;
            callLater(this.changeItems);
            return;
        }// end function

    }
}
